import { Adapter } from "../adapter/adapter";
import { BitMath } from "../math/math";


export namespace App_Interface
{
    export interface IFramework
    {
        render?: Adapter.IRenderAdapter | null;
        audio?: Adapter.IAudioAdapter | null;
    }
    export interface IUserCode
    {
        OnInit(app: IFramework): Promise<void>;
        OnUpdate(app: IFramework): void;
    }

    export interface IGridElement
    {
        readonly IsGroup: boolean;

        readonly TileXGlobal: number;
        readonly TileYGlobal: number;
        readonly TileRectLocal: BitMath.Rect;
        OnDraw(render: Adapter.IRenderAdapter): void;
        readonly Parent: IGridElementGroup | null;
        SetParent(parent: IGridElementGroup | null): void;
    }
    export interface IGridElementGroup extends IGridElement
    {
        readonly children: IGridElement[];

        AddChild(element: IGridElement): void;
        RemoveChild(element: IGridElement): void

        OnParentResize(tileWidth: number, tileHeight: number): void
    }

}
